
using System;
using GeoFramework.IO;
#if !PocketPC
using System.Runtime.Serialization;
#endif

namespace GeoFramework.Gps.Nmea
{
	/// <summary>
	/// Represents information about an NMEA sentence processing error.
	/// </summary>
    public class NmeaSentenceException : PacketException
	{
		public NmeaSentenceException() : base()
		{
		}
	
		public NmeaSentenceException(NmeaSentence sentence, string message) 
			: base(sentence, message)
		{
		}
	
		public NmeaSentenceException(NmeaSentence sentence, string message, Exception innerException) 
			: base(sentence, message, innerException)
		{
		}
	
#if !PocketPC
		protected NmeaSentenceException(SerializationInfo info, StreamingContext context) : base(info, context)
		{
		}
#endif

		/// <summary>Returns the NMEA sentence which caused the error.</summary>
		public NmeaSentence Sentence
		{
			get
			{
				return (NmeaSentence)Packet;
			}
		}
	}

	//[CLSCompliant(false)]
	public class NmeaSentenceExceptionEventArgs : PacketExceptionEventArgs
	{
		public new static readonly NmeaSentenceExceptionEventArgs Empty = new NmeaSentenceExceptionEventArgs(null);

		public NmeaSentenceExceptionEventArgs(NmeaSentenceException exception) 
			: base(exception)
		{
		}

		public NmeaSentence Sentence
		{
			get
			{
				return ((NmeaSentenceException)Exception).Sentence;
			}
		}
	}

	public delegate void NmeaSentenceExceptionEventHandler(object sender, NmeaSentenceExceptionEventArgs e);

}
